home *** CD-ROM | disk | FTP | other *** search
/ OpenGL Superbible (2nd Edition) / OpenGL SuperBible e2.iso / tools / FLTK-1.0.6 / test / boxtype.cxx < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-07  |  2.9 KB  |  94 lines

  1. //
  2. // "$Id: boxtype.cxx,v 1.4 1999/01/07 19:17:49 mike Exp $"
  3. //
  4. // Boxtype test program for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-1999 by Bill Spitzak and others.
  7. //
  8. // This library is free software; you can redistribute it and/or
  9. // modify it under the terms of the GNU Library General Public
  10. // License as published by the Free Software Foundation; either
  11. // version 2 of the License, or (at your option) any later version.
  12. //
  13. // This library is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16. // Library General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Library General Public
  19. // License along with this library; if not, write to the Free Software
  20. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  21. // USA.
  22. //
  23. // Please report all bugs and problems to "fltk-bugs@easysw.com".
  24. //
  25.  
  26. #include <stdlib.h>
  27. #include <stdio.h>
  28. #include <FL/Fl.H>
  29. #include <FL/Fl_Single_Window.H>
  30. #include <FL/Fl_Box.H>
  31.  
  32. int N = 0;
  33. #define W 150
  34. #define H 50
  35. #define ROWS 8
  36.  
  37. Fl_Window *window;
  38.  
  39. void bt(const char *name, Fl_Boxtype type, int square=0) {
  40.   int x = N%4;
  41.   int y = N/4;
  42.   N++;
  43.   x = x*W+10;
  44.   y = y*H+10;
  45.   Fl_Box *b = new Fl_Box(type,x,y,square ? H-20 : W-20,H-20,name);
  46.   b->labelsize(11);
  47.   if (square) b->align(FL_ALIGN_RIGHT);
  48. }
  49.  
  50. int main(int argc, char ** argv) {
  51.   window = new Fl_Single_Window(4*W,ROWS*H);
  52.   window->box(FL_FLAT_BOX);
  53.   window->color(12);// light blue
  54.   bt("FL_NO_BOX",FL_NO_BOX);
  55.   bt("FL_FLAT_BOX",FL_FLAT_BOX);
  56.   N += 2; // go to start of next row to line up boxes & frames
  57.   bt("FL_UP_BOX",FL_UP_BOX);
  58.   bt("FL_DOWN_BOX",FL_DOWN_BOX);
  59.   bt("FL_UP_FRAME",FL_UP_FRAME);
  60.   bt("FL_DOWN_FRAME",FL_DOWN_FRAME);
  61.   bt("FL_THIN_UP_BOX",FL_THIN_UP_BOX);
  62.   bt("FL_THIN_DOWN_BOX",FL_THIN_DOWN_BOX);
  63.   bt("FL_THIN_UP_FRAME",FL_THIN_UP_FRAME);
  64.   bt("FL_THIN_DOWN_FRAME",FL_THIN_DOWN_FRAME);
  65.   bt("FL_ENGRAVED_BOX",FL_ENGRAVED_BOX);
  66.   bt("FL_EMBOSSED_BOX",FL_EMBOSSED_BOX);
  67.   bt("FL_ENGRAVED_FRAME",FL_ENGRAVED_FRAME);
  68.   bt("FL_EMBOSSED_FRAME",FL_EMBOSSED_FRAME);
  69.   bt("FL_BORDER_BOX",FL_BORDER_BOX);
  70.   bt("FL_SHADOW_BOX",FL_SHADOW_BOX);
  71.   bt("FL_BORDER_FRAME",FL_BORDER_FRAME);
  72.   bt("FL_SHADOW_FRAME",FL_SHADOW_FRAME);
  73.   bt("FL_ROUNDED_BOX",FL_ROUNDED_BOX);
  74.   bt("FL_RSHADOW_BOX",FL_RSHADOW_BOX);
  75.   bt("FL_ROUNDED_FRAME",FL_ROUNDED_FRAME);
  76.   bt("FL_RFLAT_BOX",FL_RFLAT_BOX);
  77.   bt("FL_OVAL_BOX",FL_OVAL_BOX);
  78.   bt("FL_OSHADOW_BOX",FL_OSHADOW_BOX);
  79.   bt("FL_OVAL_FRAME",FL_OVAL_FRAME);
  80.   bt("FL_OFLAT_BOX",FL_OFLAT_BOX);
  81.   bt("FL_ROUND_UP_BOX",FL_ROUND_UP_BOX);
  82.   bt("FL_ROUND_DOWN_BOX",FL_ROUND_DOWN_BOX);
  83.   bt("FL_DIAMOND_UP_BOX",FL_DIAMOND_UP_BOX);
  84.   bt("FL_DIAMOND_DOWN_BOX",FL_DIAMOND_DOWN_BOX);
  85.   window->resizable(window);
  86.   window->end();
  87.   window->show(argc,argv);
  88.   return Fl::run();
  89. }
  90.  
  91. //
  92. // End of "$Id: boxtype.cxx,v 1.4 1999/01/07 19:17:49 mike Exp $".
  93. //
  94.